<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Order extends Model
{
    use SoftDeletes;

    protected $table = 'order';

    protected $fillable = [
		'order_sn','user_id','province_id','city_id','county_id','address','username','tel','remark','express_type','express_price','goods_total','price_total','order_type','coupon_id',
        'active_id','org_price_total'
	];

	/**
	 * 订单用户的关联
	 * User: Clannad ~ ☆
	 * DataTime：2019/11/19 0019 11:07
	 */
	public function user()
    {
		return $this->belongsTo(User::class,'user_id','id');
    }

	/**
	 * 关联商品表
	 * User: Clannad ~ ☆
	 * DataTime：2019/11/19 0019 14:08
	 * @return \Illuminate\Database\Eloquent\Relations\HasMany
	 */
	public function orderInfo()
    {
		return $this->hasMany(OrderInfo::class,'order_id','id');
    }
}
